class Tool:
    count = 0  # 类属性

    def __init__(self, name):
        self.name = name
        Tool.count += 1  # 类属性的访问方法

    @classmethod  # 装饰器
    def show_tool_count(cls):
        print(cls)
        print('工具类创建了%d个对象' % cls.count)


if __name__ == '__main__':
    tool1 = Tool('锤子')
    tool2 = Tool('螺丝刀')
    tool3 = Tool('扳手')
    print(Tool.count)
    Tool.show_tool_count()
